<template>
	<view>
		<u-subsection :list="list" :current="current" @change="change" active-color="#ff9900"></u-subsection>
		<view class="order-list">
			<view class="order-item" v-for="item in orderList">
				<view class="top">
					<text>{{item.path}}</text>
					<view class="status center" v-if="item.status === 0">未付款</view>
					<view class="status center" v-else style="background-color: #909399;">已付款</view>
				</view>
				<view class="id">订单编号：{{item.orderNum}}</view>
				<view class="date">订单生成日期：{{item.createTime}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [
					{
						name: '未付款'
					},
					{
						name: '已付款'
					}
				],
				current: 0,
				orderList:[]
			};
		},
		onLoad() {
			this.getOrder()
		},
		methods: {
			change(index){
				this.current = index
				this.getOrder()
			},
			getOrder(){
				this.$request({
					url: '/prod-api/api/bus/order/list'
				}).then(res => {
					console.log(res)
					this.orderList = res.rows.filter(item => item.status === this.current)
				})
			}
		}
	}
</script>

<style lang="scss">
	page{
		background-color: #f7f7f7;
		view{
			.order-list{
				display: flex;
				flex-direction: column;
				padding: 20rpx;
				.order-item{
					padding: 20rpx;
					background-color: #fff;
					.top{
						display: flex;
						flex-direction: row;
						justify-content: space-between;
						align-items: center;
						padding: 20rpx 0;
						border-bottom: 4rpx solid #e4e7ed;
						text{
							color: #2979ff;
							font-weight: bold;
							font-size: 32rpx;
						}
						.status{
							width: 120rpx;
							height: 60rpx;
							font-size: 26rpx;
							color: white;
							background-color: #fa3534;
							border-radius: 10rpx;
						}
					}
					.id{
						padding: 20rpx 0;
						font-size: 26rpx;
					}
					.date{
						font-size: 26rpx;
					}
				}
			}
		}
	}
</style>
